package com.ssh;

import java.util.ArrayList;
import java.util.List;

import org.junit.Test;

public class PartitionLabels_763 {
	public List<Integer> partitionLabels(String s) {
        int index = 0, i = 0, j = 0;
        List<Integer> list = new ArrayList<>();
        while (i < s.length()) {
        	 j = i;
        	 do {
             	index = Math.max(index, s.lastIndexOf(s.charAt(i)));
             	i++;
             }while (i <= index);
             list.add(index-j+1);
             
        }
        return list;
    }
	@Test
	public void test() {
		System.out.println(partitionLabels("ababcbacadefegdehijhklij"));
	}
}
